<?php
/*!
 * Theme Name:One Nav
 * Theme URI:https://www.iotheme.cn/
 * Author:iowen
 * Author URI:https://www.iowen.cn/
 */
if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title><?php _e( '登陆', 'i_theme' ); ?> - <?php bloginfo('name') ?></title>
<link rel="shortcut icon" href="<?php echo io_get_option('favicon')['url'] ?>">
<link rel="apple-touch-icon" href="<?php echo io_get_option('apple_icon')['url'] ?>">
<meta name='robots' content='noindex,nofollow' />
<link rel="stylesheet" href="<?php echo get_theme_file_uri('/css/iconfont.css') ?>?ver=<?php echo VERSION ?>" type="text/css">
<link rel="stylesheet" href="<?php echo get_theme_file_uri('/css/bootstrap.min.css') ?>?ver=<?php echo VERSION ?>" type="text/css"/>
 
<?php do_action('login_head', 'resetpass'); ?>
<?php $login_color = io_get_option('login_color'); ?>

<style> 
    body {
        background: linear-gradient(45deg, <?php echo $login_color['color-l'] ?>, <?php echo $login_color['color-r'] ?>);
    	height: 100vh;
    }
    .login-page {
        position: relative;
    }
    .login-page .container {
        min-height: 100vh;
        z-index: 999;
        padding: 20px;
        position: relative;
    }
    .login-page .form-holder {
        width: 100%;
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 50px;
    }
    .has-shadow {
        -webkit-box-shadow: 0 20px 0 -10px rgba(255, 255, 255, 0.3), 0 40px 0 -20px rgba(255, 255, 255, 0.1);
        box-shadow: 0 20px 0 -10px rgba(255, 255, 255, 0.3), 0 40px 0 -20px rgba(255, 255, 255, 0.1);
    } 
    .login-page .form-holder .info, .login-page .form-holder .form {
        min-height: 450px;
        height: 100%;
    }
    .login-page .form-holder .info {
        background: rgba(241, 64, 75, .9);
        color: #fff;
        background-size: cover;
        background-position: 50% 50%;
        background-repeat: no-repeat;
    }
    .login-page .form-holder .form .content {
        width: 100%;
    }
    .login-page .form-holder .form form {
        width: 100%; 
    } 
    button, input {
        outline: none !important;
    }
    input.input-material {
        width: 100%;
        border: none;
        border-bottom: 1px solid #eee;
        padding: 10px 0;
        transition: .3s;
        letter-spacing: .25rem;
    }
    input.input-material.is-invalid {
      border-color: #f1404b !important;
    }

    input.input-material:focus {
      border-color: #f1404b;
    }
    .btn-danger {
      color: color-yiq(#f1404b);
      background-color: #f1404b;
      border-color: #f1404b;
      box-shadow: 0 6px 20px -5px #f1404b;
    }
    .btn-danger:hover {
      color: color-yiq(#222);
      background-color: #222;
      border-color: #222;
      box-shadow: none;
    }
    .btn-danger:focus, .btn-danger.focus {
      -webkit-box-shadow: 0 0 0 0.2rem rgba(241, 64, 75, 0.5);
      box-shadow: 0 0 0 0.2rem rgba(241, 64, 75, 0.5);
    }
    .btn-danger.disabled, .btn-danger:disabled {
      color: color-yiq(#f1404b);
      background-color: #f1404b;
      border-color: #f1404b;
    }
    .btn-danger:not(:disabled):not(.disabled):active, .btn-danger:not(:disabled):not(.disabled).active,
    .show > .btn-danger.dropdown-toggle {
      color: color-yiq(#222);
      background-color: #222;
      border-color: #222;
    }
    .btn-danger:not(:disabled):not(.disabled):active:focus, .btn-danger:not(:disabled):not(.disabled).active:focus,
    .show > .btn-danger.dropdown-toggle:focus {
      -webkit-box-shadow: 0 0 0 0.2rem rgba(20, 20, 20, 0.5);
      box-shadow: 0 0 0 0.2rem rgba(20, 20, 20, 0.5);
    }
    .btn-outline-danger {
      color: #f1404b;
      border-color: #f1404b;
    }

    .btn-outline-danger:hover {
      color: #fff;
      background-color: #f1404b;
      border-color: #f1404b;
          box-shadow: 0 6px 20px -5px #f1404b;
    }

    .btn-outline-danger:focus, .btn-outline-danger.focus {
      box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5);
    }

    .btn-outline-danger.disabled, .btn-outline-danger:disabled {
      color: #f1404b;
      background-color: transparent;
    }

    .btn-outline-danger:not(:disabled):not(.disabled):active, .btn-outline-danger:not(:disabled):not(.disabled).active,
    .show > .btn-outline-danger.dropdown-toggle {
      color: #fff;
      background-color: #f1404b;
      border-color: #f1404b;
    }

    .btn-outline-danger:not(:disabled):not(.disabled):active:focus, .btn-outline-danger:not(:disabled):not(.disabled).active:focus,
    .show > .btn-outline-danger.dropdown-toggle:focus {
      box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5);
    }

    .iconfont {
        display: inline-block;
        font-size: inherit;
        font-variant: normal;
        text-rendering: auto;
        line-height: 1;
    }
    .icon-spin{
        -webkit-animation:icon-spin 2s infinite linear;
        animation:icon-spin 2s infinite linear;
    }
    @-webkit-keyframes icon-spin{
        0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}
        100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}
    }
    @keyframes icon-spin{
        0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}
        100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}
    }
    .footer-copyright{
        position: absolute;
        bottom: 0;
        width: 100%;
    }
    .openlogin-box{display:block;margin-bottom:10px !important;}
    .openlogin-box a{width:35px;height:35px;line-height:35px;text-align:center;display:inline-block;margin-right:10px;color:#fff;border-radius:3px;text-decoration: none;background:#19b6f5}
    .openlogin-box a.openlogin-weibo-a{background:#ff545a}
    .openlogin-box a.openlogin-wechat-a{background:#2fac1a}
</style>
</head>
<body <?php body_class(theme_mode()); ?> >
    <div class="page login-page">
        <div class="container d-flex align-items-center">
            <div class="form-holder has-shadow">
                <div class="row no-gutters">
                    <!-- Logo & Information Panel-->
                    <div class="col-md-6 col-lg-7 d-none d-md-block">
                        <div class="info d-flex p-5" style="background-image: url(<?php echo io_get_option('login_ico')['url'] ?>);">
                            <div class="content">
                                <div class="logo">
                                    <h1><?php bloginfo('name') ?></h1>
                                </div>
                                <p><?php bloginfo('description') ?></p>
                            </div>
                        </div>
                    </div>
                    <!-- Form Panel    -->
                    <div class="col-12 col-md-6 col-lg-5 bg-white">
                        <div class="form d-flex align-items-center p-4 p-md-5">
                            <div class="content">
                                <div class="sign-header h4 mb-3 mb-md-5"><?php _e('欢迎回来','i_theme') ?></div>
                                <div id="result" style="color:#f1404b;height:30px"></div>
                                <form method="post" action="" class="form-validate mb-3" id="wp_login_form">
                                    <div class="form-group mb-4">
                                        <input type="text" name="username" placeholder="<?php _e('用户名或邮箱','i_theme') ?>" class="input-material">
                                    </div>
                                    <div class="form-group mb-4">
                                        <input type="password" name="password" placeholder="<?php _e('密码','i_theme') ?>" class="input-material">
                                    </div> 
                                    <div class="custom-control custom-checkbox mb-4">
                                    <input type="checkbox" class="custom-control-input" checked="checked" name="rememberme" id="check1" value="forever">
                                    <label class="custom-control-label" for="check1"><?php _e('记住我的登录信息','i_theme') ?></label>
                                    </div>  
                                    <div class="d-flex">
                                        <?php  if( LOGIN_007 && io_get_option('io_captcha')['tcaptcha_007'] && io_get_option('io_captcha')['appid_007'] ) { ?>
                                        <input class="btn btn-danger px-4 px-lg-5" type="button" id="TencentCaptcha" value="<?php _e('登录','i_theme') ?>" data-appid="<?php echo io_get_option('io_captcha')['appid_007'] ?>" data-cbfn="loginTicket"/>
                                        <?php } else { ?>
                                        <button id="submitbtn" type="submit" class="btn btn-danger px-4 px-lg-5"><?php _e('登录','i_theme') ?></button>
                                        <?php } ?> 
                                        <a href="<?php echo home_url() ?>" class="btn btn-outline-danger px-4 px-lg-5 ml-auto"><?php _e('首页','i_theme') ?></a>
                                    </div> 
                                </form> 
                                <div class=" text-muted">
                                    <small>没有账号? <a href="<?php echo home_url('/login/') ?>?action=register" class="signup"><?php _e('注册','i_theme') ?></a> / <a href="<?php echo home_url('/login/') ?>?action=lostpassword" class="signup"><?php _e('找回密码','i_theme') ?></a></small> 
                                </div>
                                <div class="login-form mt-4 mb-n4"><?php do_action('login_form', 'resetpass'); ?></div>
                                 <script>
                                       var m=window.self === window.top;//如果被嵌套了。
                                        if(m==false)
                                        {
                                            $(".openlogin-qq-a").attr("target","_blank");
                                        }
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="footer-copyright my-4">
            <div class="text-muted text-center">
                <small>Copyright © <a href="<?php echo home_url() ?>" title="<?php bloginfo('name') ?>" rel="home"><?php bloginfo('name') ?></a></small> 
            </div>
        </div>
    </div>
    
    <script type="text/javascript" src="<?php echo get_theme_file_uri('/js/jquery.min.js') ?>?ver=<?php echo VERSION ?>"></script>
    <script type="text/javascript">//ajax 提交数据 
        $("#wp_login_form").submit(function() {
              //请准备一个gif图 
                $('#result').html('<i class="loader iconfont icon-loading icon-spin icon-2x"></i>').fadeIn();
                var input_data = $('#wp_login_form').serialize();
                //console.log(coupon); return;
                $.ajax({
                    type: "POST",
                    url: "<?php echo "//" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>",
                    data: input_data,
                    success: function(msg){
                        $('div#result').html('');
                        $('<div>').html(msg).appendTo('div#result').hide().fadeIn('slow');
                    }
                });
                return false;
        });  
    </script>

</body>
</html>